/* Copyright (c) 2004-2022 peigen.info. All rights reserved. */

package info.peigen.hotpot.common.core.result.facade;

import com.google.common.collect.Maps;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

/**
 * <b>(LinkedHashMapParameterize)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/4/9
 */
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LinkedHashMapParameterize<K, V> implements Parameterize<K, V> {

    @Builder.Default
    @ApiModelProperty(value = "附加参数", position = 100)
    Map<K, V> map = Maps.newLinkedHashMap();

    @Override
    public void setParameter(K key, V value) {
        this.map.put(key, value);
    }

    @Override
    public V getParameter(K key) {
        return this.map.get(key);
    }

    @Override
    public void removeParameter(K key) {
        this.map.remove(key);
    }

    @Override
    public Map<K, V> getParameters() {
        return this.map;
    }

    @Override
    public void setParameters(Map<K, V> parameters) {
        this.map = parameters;
    }

    @Override
    public Set<K> keySet() {
        return this.map.keySet();
    }

    @Override
    public Collection<V> values() {
        return this.map.values();
    }

    @Override
    public void clear() {
        this.map.clear();
    }
}